﻿<my:ClosableTabItemBase x:Class="ClosableTabItem"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:my="clr-namespace:Errisy"
             mc:Ignorable="d" 
             d:DesignHeight="24" d:DesignWidth="300">
    <my:ClosableTabItemBase.Template>
        <ControlTemplate TargetType="{x:Type my:ClosableTabItemBase}">
            <Border Name="_Border" BorderThickness="1" BorderBrush="Gray" CornerRadius="0,4,0,0" Padding="2">
                <Grid Name="Grid">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="2"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="2"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <ContentPresenter Grid.Column="1" ContentSource="Header"/>
                    <my:CloseButton Grid.Column="3" Click="TryCloseTab" Width="{Binding Path=ActualHeight, ElementName=Grid}"/>
                </Grid>
            </Border>
            <ControlTemplate.Triggers>
                <Trigger Property="IsSelected" Value="True">
                    <Setter TargetName="_Border" Property="BorderBrush" Value="OrangeRed"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
    </my:ClosableTabItemBase.Template>
</my:ClosableTabItemBase>
